%%
ccc

%%
filePath = '/Users/rowland/Dropbox/FolderSync/Engineering/Projects/gyrobots/data/flight001/';
fileName = 'LOG-9964.csv';

%%
loadVarsFromCSV(fullfile(filePath,fileName));

%%
nSamples = length(AccX);
timeMat = (0:.25:(nSamples-1)*.25)';

accMat = zeros(nSamples,3);
gyroMat = zeros(nSamples,3);
altMat = zeros(nSamples,1);
tempMat = zeros(nSamples,1);
magMat = zeros(nSamples,1);

for iSample = 1:nSamples
    accMat(iSample,1) = str2double(AccX{iSample});
    accMat(iSample,2) = str2double(AccY{iSample});
    accMat(iSample,3) = str2double(AccZ{iSample});
    
    gyroMat(iSample,1) = str2double(GyroX{iSample});
    gyroMat(iSample,2) = str2double(GyroY{iSample});
    gyroMat(iSample,3) = str2double(GyroZ{iSample});
    
    magMat(iSample,1) = str2double(MagX{iSample});
    magMat(iSample,2) = str2double(MagY{iSample});
    magMat(iSample,3) = str2double(MagZ{iSample});
    
    altMat(iSample,1) = str2double(Altitude{iSample});
    tempMat(iSample,1) =str2double(Temperature{iSample});
    
end

%%
figure(1)
plot(timeMat,accMat(:,1),'b')
hold on
plot(timeMat,accMat(:,2),'g')
plot(timeMat,accMat(:,3),'r')
hold off
title('Accelerometer');
legend('X','Y','Z')


figure(2)
plot(timeMat,gyroMat(:,1),'b')
hold on
plot(timeMat,gyroMat(:,2),'g')
plot(timeMat,gyroMat(:,3),'r')
hold off
title('Gyro');
legend('X','Y','Z')


figure(3)
plot(timeMat,magMat(:,1),'b')
hold on
plot(timeMat,magMat(:,2),'g')
plot(timeMat,magMat(:,3),'r')
hold off
title('Magnetometer')
legend('X','Y','Z')

figure(4)
plot(timeMat,altMat(:,1),'b')
legend('Altitude');
title('Pressure Sensor');
figure(4)
plot(timeMat,tempMat(:,1),'b')
legend('Temperature');
title('Pressure Sensor');